package com.yonyou.cyxdms.basedata.service.controller.templateconf;

import com.yonyou.cyxdms.basedata.client.domains.vo.PageTemplateConfVO;
import com.yonyou.cyxdms.basedata.service.service.templateconf.PageTemplateConfService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 关爱对象模板配置
 *
 * @author renwd
 * @since 2019/9/23
 */
@Api(value = "PageTemplateConfController", tags = "关爱对象")
@RestController
@RequestMapping("/pageTemplateConfs")
public class PageTemplateConfController {

    @Autowired
    private PageTemplateConfService pageTemplateConfService;

    /**
     * 根据配置代码查询页面模板配置信息
     *
     * @param confCode
     * @return java.util.List<com.yonyou.cyxdms.basedata.service.vo.templateconf.PageTemplateConfVO>
     * @author renwd
     * @since 2019/9/23
     */
    @ApiOperation(value = "根据配置代码查询页面模板配置信息")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "userId", name = "userId", required = true, dataType = "string", paramType = "header")
    })
    @GetMapping(value = "/{confCode}")
    public List<PageTemplateConfVO> listPageTemplateConfByConfCode(@PathVariable(value = "confCode") Integer confCode) {
        return pageTemplateConfService.listPageTemplateConfByConfCode(confCode);
    }

    /**
     * 根据配置代码查询页面模板配置信息(没有登录信息)
     *
     * @param confCode confCode
     * @param appId appId
     * @param ownerCode ownerCode
     * @return java.util.List<com.yonyou.cyxdms.basedata.client.domains.vo.PageTemplateConfVO>
     * @author renwd
     * @since 2019/10/8
     */
    @ApiOperation(value = "根据配置代码查询页面模板配置信息(没有登录信息)")
    @GetMapping(value = "/listPageTemplateConfWithoutLoginInfo")
    public List<PageTemplateConfVO> listPageTemplateConfWithoutLoginInfo(@RequestParam Integer confCode, @RequestParam String appId, @RequestParam String ownerCode) {
        return pageTemplateConfService.listPageTemplateConfWithoutLoginInfo(confCode, appId, ownerCode);
    }

}
